package com.constants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.middleware.race.sync.Server;
import com.sync.utils.OSEnvir;

public abstract class Base {

	protected static final Logger loggerServer = LoggerFactory
			.getLogger(Server.class);
	public static String MAC_DATA_HOME = "/Users/yh/data/rematch/test/";
	public static String MAC_MIDDLE_HOME = "/Users/yh/data/rematch/test/";
	public static String MAC_RESULT_HOME = "/Users/yh/data/rematch/test/";
	public static String DATA_HOME = "E:/alibaba/test/";
	public static String MIDDLE_HOME = "E:/alibaba/middle/";
	public static String RESULT_HOME = "E:/alibaba/middle/";
	public static int start = 100001;
	public static int end = 1999999;
	public static int reply_buff =1024 * 1024 * 80;
	
	/**
	 * 64K
	 */
	public static final int BLOCK_SIZE_NORMAL = 1024 * 64;
	/**
	 * 64K+200
	 */
	public static final int BLOCK_SIZE_EXTEND = BLOCK_SIZE_NORMAL + 200;
	public static int PaserThreadNum = 4;
	public static int ReplayThreadNum = 4; // 2=1 4=3,8=7
	public static int mod = 3;

	public static final byte SEP = '|';
	public static final byte SEP2 = ':';
	public static final byte SEPLINE = '\n';
	public static final byte TAB = '\t';

	public static final byte UPDATE = 'U';
	public static final byte INSERT = 'I';
	public static final byte DELETE = 'D';
	public static final int ZERO = 48;

	public static final String charsetName = "utf8";
	public static final String FILE_SUFFIX = ".txt";

	static {
		if (!OSEnvir.isWindows() && !OSEnvir.isMacOS()) {
			DATA_HOME = Constants.DATA_HOME;
			MIDDLE_HOME = Constants.MIDDLE_HOME;
			RESULT_HOME = Constants.RESULT_HOME;
			start = 1000001;
			end = 7999999;
			reply_buff = 1024 * 1024 * 60;
			PaserThreadNum = 4;
			ReplayThreadNum = 8;
			mod = 15;
		}
		
		if (OSEnvir.isMacOS()) {
			DATA_HOME = MAC_DATA_HOME;
			MIDDLE_HOME = MAC_MIDDLE_HOME;
			RESULT_HOME = MAC_RESULT_HOME;
		}
	}

}
